import requests
import re

ac_id= input('请输入你要下载点视频ID:')

url = f'https://www.acfun.cn/v/{ac_id}'

headers = {
     'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'
}

resp = requests.get(url, headers=headers)

#print(resp.text)

# 获取视频的标题
title = re.findall('<span>(.*?)</span>',resp.text)[0]
print(title)

#获取 m3u8 URL地址
m3u8_url = re.findall('backupUrl(.*?)\"]', resp.text)[0].replace('"', '').split('\\')[2]
print(m3u8_url)


